/*
 * Copyright 2011 Clean GWT
 * 
 * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except
 * in compliance with the License. You may obtain a copy of the License at
 * 
 * http://www.apache.org/licenses/LICENSE-2.0
 * 
 * Unless required by applicable law or agreed to in writing, software distributed under the License
 * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
 * or implied. See the License for the specific language governing permissions and limitations under
 * the License.
 */
package com.cleangwt.bootstrap.client.style;

import com.google.gwt.user.client.ui.Widget;

/**
 * This class provides text styles.
 * 
 * @author Jess
 * @version 1.0
 * @since 1.0
 */
public class Texts {
  public static final String MUTED_STYLE = "text-muted";
  public static final String PRIMARY_STYLE = "text-primary";
  public static final String SUCCESS_STYLE = "text-success";
  public static final String WARNING_STYLE = "text-warning";
  public static final String DANGER_STYLE = "text-danger";
  public static final String INFO_STYLE = "text-info";

  /**
   * The align style.
   */
  public static final String TEXT_LEFT = "text-left";
  /**
   * The align style.
   */
  public static final String TEXT_RIGHT = "text-right";
  /**
   * The align style.
   */
  public static final String TEXT_CENTER = "text-center";

  /**
   * Adds {@link #TEXT_LEFT} to the given widget and remove other align related style.
   * 
   * @param widget the widget
   * @return the widget itself
   */
  public static Widget left(Widget w) {
    w.removeStyleName(TEXT_RIGHT);
    w.removeStyleName(TEXT_CENTER);
    w.addStyleName(TEXT_LEFT);
    return w;
  }

  /**
   * Adds {@link #TEXT_RIGHT} to the given widget and remove other align related style.
   * 
   * @param widget the widget
   * @return the widget itself
   */
  public static Widget right(Widget w) {
    w.removeStyleName(TEXT_LEFT);
    w.removeStyleName(TEXT_CENTER);
    w.addStyleName(TEXT_RIGHT);
    return w;
  }

  /**
   * Adds {@link #TEXT_CENTER} to the given widget and remove other align related style.
   * 
   * @param widget the widget
   * @return the widget itself
   */
  public static Widget center(Widget w) {
    w.removeStyleName(TEXT_LEFT);
    w.removeStyleName(TEXT_RIGHT);
    w.addStyleName(TEXT_CENTER);
    return w;
  }

  /**
   * Sets the {@link #MUTED_STYLE} for the given widget.
   * 
   * @param w the widget
   * @return the widget ifself
   */
  public static Widget muted(Widget w) {
    w.setStyleName(MUTED_STYLE);
    return w;
  }

  /**
   * Sets the {@link #PRIMARY_STYLE} for the given widget.
   * 
   * @param w the widget
   * @return the widget ifself
   */
  public static Widget primary(Widget w) {
    w.setStyleName(PRIMARY_STYLE);
    return w;
  }

  /**
   * Sets the {@link #INFO_STYLE} for the given widget.
   * 
   * @param w the widget
   * @return the widget ifself
   */
  public static Widget info(Widget w) {
    w.setStyleName(INFO_STYLE);
    return w;
  }

  /**
   * Sets the {@link #SUCCESS_STYLE} for the given widget.
   * 
   * @param w the widget
   * @return the widget ifself
   */
  public static Widget success(Widget w) {
    w.setStyleName(SUCCESS_STYLE);
    return w;
  }

  /**
   * Sets the {@link #WARNING_STYLE} for the given widget.
   * 
   * @param w the widget
   * @return the widget ifself
   */
  public static Widget warning(Widget w) {
    w.setStyleName(WARNING_STYLE);
    return w;
  }

  /**
   * Sets the {@link #DANGER_STYLE} for the given widget.
   * 
   * @param w the widget
   * @return the widget ifself
   */
  public static Widget danger(Widget w) {
    w.setStyleName(DANGER_STYLE);
    return w;
  }
}
